﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Intergr8.Data.Query
{
    public class ClauseCollection : System.Collections.Generic.Dictionary<string, Clause>
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="key"></param>
        /// <param name="value"></param>
        public new void Add(string key, Clause value)
        {
            //Only add clauses that have a location, otherwise they dont exist in the query
            if (value.Index == -1)
            {
                return;
            }

            if(base.ContainsKey(value.Type))
            {
                base.Remove(value.Type);
            }

            base.Add(key, value);
            
        }
    }
}
